<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>添加/编辑角色 - Powered By ${systemConfig.systemName}</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="${base}/template/assets/i/favicon.png">

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="icon" sizes="192x192" href="${base}/template/assets/i/app-icon72x72@2x.png">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
  <link rel="apple-touch-icon-precomposed" href="${base}/template/assets/i/app-icon72x72@2x.png">

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="${base}/template/assets/i/app-icon72x72@2x.png">
  <meta name="msapplication-TileColor" content="#0e90d2">

  <link rel="stylesheet" href="${base}/template/assets/css/amazeui.min.css">
  <link rel="stylesheet" href="${base}/template/assets/css/app.css">
  <link rel="stylesheet" href="${base}/template/assets/css/admin.css">
  <script src="${base}/template/assets/js/jquery.min.js"></script>
  <%
	var isAdd = false;
	var isEdit = false;
	if(isEmpty(role.id)){
		isAdd = true;
	}else{
		isEdit = true;
  }%>
</head>
<body>
<!--在这里编写你的代码-->
<div class="admin-content">
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">管理员</strong> / <small><%if(isAdd){%>添加角色<%}else{%>编辑角色<%}%></small></div>
  </div>
 <hr style="am-padding-bottom:2px;margin:0px;"/>
 <form id="inputForm" class="am-form" action="<%if (isAdd){%>${base}/role/save<%}else{%>${base}/role/update<%}%>" method="post">
  <div class="am-tabs am-margin" data-am-tabs style="padding-top:5px;margin:0px;">
	    <ul class="am-tabs-nav am-nav am-nav-tabs">
	      <li class="am-active"><a href="#tab1">基本信息</a></li>
	      <li><a href="#tab2">分配资源</a></li>
	    </ul>
    <div class="am-tabs-bd">
      <div class="am-tab-panel am-fade am-in am-active" id="tab1">
        <input type="hidden" name="role.id" value="${role.id!}" />

          <div class="am-g am-margin-top">
            <div class="am-u-sm-4 am-u-md-1 am-text-right">角色名称</div>
            <div class="am-u-sm-8 am-u-md-4">
              <input type="text" name="role.name" class="am-input-sm" value="${role.name!}" required/>
            </div>
            <div class="am-hide-sm-only am-u-md-6 am-text-warning">${nameMessages!}</div>
          </div>

          <div class="am-g am-margin-top">
            <div class="am-u-sm-4 am-u-md-1 am-text-right">角色标识</div>
            <div class="am-u-sm-8 am-u-md-4">
              <input type="text" name="role.value" class="am-input-sm" value="${role.value!}" title="必须以ROLE_开头" required/>
            </div>
            <div class="am-hide-sm-only am-u-md-6 am-text-warning">${valueMessages!}</div>
          </div>

          <div class="am-g am-margin-top">
            <div class="am-u-sm-4 am-u-md-1 am-text-right">描述</div>
            <div class="am-u-sm-8 am-u-md-4">
              <input type="text" name="role.description" class="am-input-sm" value="${role.description!}" />
            </div>
            <div class="am-hide-sm-only am-u-md-6 am-text-warning">&nbsp;</div>
          </div>
      </div>
      <div class="am-tab-panel am-fade" id="tab2">
         <%for(list in allResource){%>
			<div style="width: 30%; float: left;">
				<label class="am-checkbox"><input type="checkbox" name="resourceIds" value="${list.id}"  class="am-input-sm" data-am-ucheck
					<% if(isEdit){
						var resourceList = role.resourceList;
						for(var i = 0; i < resourceList.~size; i++){
							if (strutil.contain(resourceList[i].id,list.id)){%> checked="checked"<%}%>
						<%}%>
					<%}%>
					/>									
					${list.name!}
				</label>
			</div>
		<%}%>
      </div>
    </div>
  </div>
  <div class="am-g am-margin-top">
	  <div class="am-u-sm-12 am-u-md-1 am-text-right admin-form-text"></div>
	  <div class="am-u-sm-12 am-u-md-11">
	  	<button type="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
	    <button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="window.history.back(); return false;">放弃保存</button>
	  </div>
  </div>
 </form>
</div>
<!-- content end -->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${base}/template/assets/js/amazeui.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<![endif]-->
</body>
</html>
